<template>
  <ul style="padding: 0">
    <!-- 分类文章 -->
    <articleCard
      v-for="(item, idx) in article_list"
      :key="item.id"
      :article="item"
    />
  </ul>
</template>

<script>
import articleCard from "@/components/client/ArticleCard.vue";
export default {
  props: ["type"],
  data() {
    return {
      types: ["最新文章", "热门文章", "评论最多", "点赞最多"],
      // 文章列表
      article_list: [],
    };
  },
  mounted() {
    this.getarticleList();
  },
  methods: {
    // 获取文章列表
    getarticleList() {
      this.$axios.get("/api/article/list.php").then((res) => {
        this.article_list = res.data.data;
      });
    },
    checkDetail(article_id) {
      this.$router.push({
        name: "article",
        params: {
          id: article_id,
        },
      });
    },
  },
  components: { articleCard },
};
</script>

<style></style>
